{% extends "base.html" %}
{% load profile_extras %}
{% block head %}
<link href="/medias/css/group.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
function postnote(){
	var n = $("#note").val();
	if(n == null|| n==""){
		$("#nerorr").text("先要有字");
		return false;
	}
	return true;
} 
function delete_note(id)
{
	if(confirm("你确定要删除吗?")){
		$.ajax({
		   type: "POST",
		   url: "/note/delete/"+id+"/",
		   success: function(result){
		     $("#note"+id).hide(500);
		   }
		}); 
	}
}
function reply_note(user,id){
	$("#note").val("@"+user+" "+$("#note").val());
}
</script>
{% endblock %}

{% block title %}mobeir社区{% endblock %}

{% block left_content %}

<div id="group_header">
	<ul>
		<li ><a href="/group/">快报</a></li>
		<li><a href="/group/my/">我的圈子</a></li>
		<li class="active"><a href="/group/topic/my/">我发起的圈子主题</a></li>
		<li><a href="/group/replies/my/">我回复的圈子主题</a></li>
	</ul>
</div>


<div id="group_header">
	<ul>
		<li ><a href="/group/">快报</a></li>
		<li class="active"><a href="/group/my/">我的圈子</a></li>
		<li><a href="/group/topic/my/">我发起的圈子主题</a></li>
		<li><a href="/group/replies/my/">我回复的圈子主题</a></li>
	</ul>
</div>

<div id="topic_list">
<table>
	<tr class="title">
		<td width="340">主题</td>
		<td width="90">作者</td>
		<td width="50">回复</td>
		<td width="100">最后回复</td>
	</tr>
{% for topic in topics.object_list %}	
	<tr class="content" height=25>
		<td ><a href="/topic/{{topic.id}}/">{{topic.title|slice:":27"|escape}}...</a></td>
		<td><a href="#">{{topic.user.username}}</a></td>
		<td>{{topic.replies_count}}</td>
		<td>{{topic.last_update|date:"Y-m-d H:i"|default:"N/A"}}</td>
	</tr>
{% endfor %}		
</table>

<div id="pagecut" class="pagination">
    <span class="step-links">
        {% if topics.has_previous %}
            <a href="?page={{ topics.previous_page_number }}"><< 较新的</a>
        {% endif %}

        <span class="current">
             {{ topics.number }} / {{ topics.paginator.num_pages }} 
        </span>

        {% if topics.has_next %}
            <a href="?page={{ topics.next_page_number }}">较早的 >></a>
        {% endif %}
    </span>
</div>
</div>

{% endblock %}

{% block right_content %}

{% if request.user.is_authenticated %}
<h3><span class="sLeft">我关注的</span><span class="sRight"></span></h3>
{% for fuser in follows %}
<div id="sub-persion">
<ul>
	<li><a href="#"><img alt="{{fuser.user.username}}" src="/medias/{{fuser.image}}" width=46 height=46 /></a></li>
	<li><a href="#">{{fuser.user.username}}</a></li>
</ul>	
</div>
{% endfor %}
{% endif %}
<div style="clear:both;"></div>
<h3><span class="sLeft">我加入的小组</span><span class="sRight"></span></h3>

{% for group in mygroups %}
<div id="sub-persion">
<ul>
	<li><a href="#"><img alt="{{group.name}}" src="/medias/{{group.image}}" width=46 height=46 /></a></li>
	<li><a href="#">{{group.name}}</a></li>
</ul>	
</div>
{% endfor %}

{% endblock %}